{% extends 'base.html' %}
{% block head %}
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<style>
    #container {width:848px; height: 300px; }
    #container2 {width:848px; height: 300px; }
</style>
{% endblock %}
{% block body %}
<div class="po_banner" style="height:237px;background:url('{{first_class.0.images_url}}') center center  no-repeat;margin-bottom:50px;">
    </div>
    <div class="w1400 po_main clear">
        <div class="left left_nav second">
            {% for i in first_class_list %}
            <h2>
                {{i.first_class}}
            </h2>
            <div class="accordion" id="accordionExample">
                <div class="card">
                    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
                        <div class="card-body">
                            <ul class="list-group">
                                {% for k in i.second_class_list %}
                                {% if k.name == second_class.name %}
                                    <li class="list-group-item cur"><a href="/second_class/{{k.id}}">{{k.name}}<span class="caret"></span></a></li>
                                {% else%}
                                    <li class="list-group-item"><a href="/second_class/{{k.id}}">{{k.name}}<span class="caret"></span></a></li>
                                {% endif %}
                                {% endfor %}
                                <li class="list-group-item address">
                                    <h5>
                                        GPTECH 上海研发中心
                                    </h5>
                                    <h6>
                                        地址：上海市奉贤区南桥镇望远南路1211号泽天产业园3号楼
                                    </h6>
                                    <h6>
                                        电话：021-33656178 / 33656176
                                    </h6>
                                </li>
                                <li class="list-group-item address">
                                    <h5>
                                        GPTECH 江苏生产工厂
                                    </h5>
                                    <h6>
                                        地址：江苏省太仓市沙溪镇大木桥397号
                                    </h6>
                                    <h6>
                                        电话：0512-53218188 / 53218288
                                    </h6>
                                </li>
                                <li class="list-group-item address">
                                    <h5>
                                        GPTECH USA
                                    </h5>
                                    <h6>
                                        Address：900W TEMPLE STREET LOS
                                    </h6>
                                    <h6>
                                        ANGELESS CA 90012
                                    </h6>
                                </li>
                                <li class="list-group-item address">
                                    <div class="img">
                                        <img src="/static/bootstrap4/img/QR.jpg" />
                                    </div>
                                    <p>
                                        GPTECH 微信公众号
                                    </p>
                                </li>
                            </ul>

                        </div>
                    </div>
                    {% endfor %}
                </div>

            </div>
        </div>
        <div class="left contact_main clear">
            <div class="path">
                首页 > {{second_class.name}}
            </div>
            <div class="ol_box">
                <div class="img">
                    <img src="/static/images/085f17aba65ffa250026f24d863d8f1_03.jpg">
                </div>

                <h2>
                    我们能为您提供什么帮助？
                </h2>
                <div class="input_box">
                    <input type="text" placeholder="请输入姓名" value="" id="name">
                </div>
                <div class="input_box">
                    <input type="text" placeholder="请输入电话" value="" id="phone">
                </div>
                <div class="input_box">
                    <input type="text" placeholder="请输入电子邮件地址" value=""  id="email">
                </div>
                <div class="input_box">
                    <input type="text" placeholder="请输入您的公司名称" value=""  id="company">
                </div>
                <div class="input_box">
                    <select id="type">
                        <option>
                            问题类型
                        </option>
                        <option>
                            业务咨询
                        </option>
                        <option>
                            了解产品
                        </option>
                        <option>
                            技术问题
                        </option>
                    </select>
                </div>
                <div class="input_box">
                    <textarea id="description" onfocus="if(value=='请输入您的具体需求'){value=''}"  onblur="if (value ==''){value='请输入您的具体需求'}">请输入您的具体需求</textarea>
                </div>
                <div class="ol_link">
                    <a class="link" href="/static/Privacy_Policy.txt" target="_blank">单击此处查看GPTECH的隐私政策，请阅读我们的隐私政策了解更多详情。</a>
                </div>
                <div class="ol_check_box clear">
                    <input type="checkbox" class="left" id="privacy"><span class="left">我接受GPTECH的隐私政策和网站条款。</span>
                </div>
                <div class="submit">
                    <button type="submit" onclick="connect(this)">提  交</button>
                </div>
            </div>

        </div>
    </div>
<script>
	function checkPhone(phone){
		if(!(/^1[3456789]\d{9}$/.test(phone))){
			return false;
		}
		return true;
	}
	function connect(btn){
        var name = $('#name').val();
        var phone = $('#phone').val();
        var checked = $('#privacy').prop('checked');
        var type = $('#type').val()
        if(type=='问题类型'){
        	alert("问题类型!");
        	return false;
        }
        if(!checked){
        	alert("请先勾选同意隐私策略!");
        	return false;
        }
        check = checkPhone(phone)
        console.log(check)
        if(!check){
        	alert("手机号码有误，请重填");
        	return false;
        }
        var email = $('#email').val();
        var company = $('#company').val();
        var description = $('#description').val();

        var data = {
            'name':name,
            'phone':phone,
            'description':description,
            'email':email,
            'company':company,
            'type':type
        }
        $.ajax({
          type: 'POST',
          url: '/connect',
          data: data,
          success: function(rtn){
            if(rtn.status == "success"){
            	alert("提交成功");
            }
          }
        });
    }
</script>
{% endblock %}